package cn.corpnet.personal.rui.learning.java8.chapter1;

import org.apache.commons.lang3.ArrayUtils;

import java.io.File;
import java.io.FileFilter;

public class Example2 {

    public void getAllSubDir(String path){
        File file = new File(path);

        // new方法
        file.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isDirectory();
            }
        });

        // Lambda表达式
        System.out.println(ArrayUtils.toString(file.listFiles(pathname -> pathname.isDirectory())));

        // 方法引用
        System.out.println(ArrayUtils.toString(file.listFiles(File::isDirectory)));
    }

    public static void main(String[] args) {
        Example2 e = new Example2();
        e.getAllSubDir("/Users/zhaoyan/Documents/EGENIE-MANAGEMENT/");
    }
}
